#ifndef GLOBALMESSAGE_H
#define GLOBALMESSAGE_H

#include "d3dUtil.h"

#include "ChessBoard.h"

#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>

class GlobalMessage
{
public:
	~GlobalMessage(void);
	static GlobalMessage* Instance();

	//get and set the time from last frame
	void				SetTimeFromLastFrame(float time);
	float				GetTimeFromLastFrame();

	//get and set the view matrix
	D3DXMATRIX			GetViewMatrix();
	void				SetViewMatrix(const D3DXMATRIX& view);

	//get and set the projection matrix
	D3DXMATRIX			GetProjMatrix();
	void				SetProjMatrix(const D3DXMATRIX& proj);

	//when the resource load success call this method
	void				ResourceLoadSuccess();

	//when resource load success return true
	bool				ResoueceIsReady();

//////////////////////////////////////////////////////////////////////////
public:
	//ChessBoard info
	ChessBoard				m_ChessBoard;
	bool					m_bSelectGrid;
	BoardCoord				m_CurrentSelectGrid;

	//a mutex use for ai thread and main thread synchronous
	boost::mutex			m_lockMutex;

//////////////////////////////////////////////////////////////////////////
private:
	GlobalMessage(void);
	GlobalMessage(const GlobalMessage&);
	GlobalMessage& operator=(const GlobalMessage&);

private:
	//Global Message
	float					m_fTimeFromLastFrame;

	D3DXMATRIX				m_matView;
	D3DXMATRIX				m_matProj;

	bool					m_bResourceReady;
};



#endif
